/**
 * @FileDescription 企业专职队api
 * @Author 祝小文
 * @CreateDate 2022-10-11 11:36
 */
import { chemical_server as request } from '@/service'

interface ResultType {
  result: {
    resultCode: string
    resultMessage: string
  }
  data: object
}

/** 适配接口返回结果 */
function adapter(response: ResultType) {
  if (response.result.resultCode == '000000') {
    return response.data
  }
  throw new Error()
}

//新增或修改企业专职队
export const AddProfessionalInfo = (params?: any) =>
  request.post(`/qyzzd/insertOrUpdate`, params).then((res) => adapter(res as any))

//根据id查询企业专职队信息
export const queryProfessionalInfo = (params?: any) =>
  request.get(`/qyzzd/queryQyzzdInfo`, { params }).then((res) => adapter(res as any))

//新增或修改企业专职队负责人信息
export const AddProContactInfo = (params?: any) =>
  request.post(`/fzrxx/insertOrUpdate`, params).then((res) => adapter(res as any))

//新增或修改消防车辆
export const AddFireCarInfo = (params?: any) => 
  request.post(`/xfcl/insertOrUpdate`,params).then(res => adapter(res as any))

//根据id查询消防车辆信息
export const quyerFireCarInfo = (params?: any) => 
  request.get(`/xfcl/queryXfclInfo`, {params}).then(res => adapter(res as any))

  //关键字查询企业专职队
export const queryTeamByKey = (params?: any) => 
request.get(`/qyzzd-view/queryQyzzdViewInfo`, {params}).then(res => adapter(res as any))

  //根据id查询负责人信息表
export const queryFzrxxInfo = (params?: any) => 
request.get(`/fzrxx/queryFzrxxInfo`, {params}).then(res => adapter(res as any))
